package com.my.study.designPatterns.iteratorPattern;


public class WaiterMenu {

    private DinnerMenu dinnerMenu;

    private PancakeHouseMenu pancakeHouseMenu;


    public WaiterMenu(DinnerMenu dinnerMenu, PancakeHouseMenu pancakeHouseMenu) {
        this.dinnerMenu = dinnerMenu;
        this.pancakeHouseMenu = pancakeHouseMenu;
    }

    public void getAllMenus(){

        printMenuItem(dinnerMenu.getDinerMenuIterator());

        System.out.println("------------------------------");

        printMenuItem(pancakeHouseMenu.getPancakeHouseMenuIterator());
    }


    public void printMenuItem(Iterator<MenuItem> menuItemIterator){


        while (menuItemIterator.hasNext()){
            MenuItem menuItem = menuItemIterator.next();
            System.out.println(menuItem);
        }
    }

    public static void main(String[] args) {

        WaiterMenu menu = new WaiterMenu(new DinnerMenu(), new PancakeHouseMenu());

        menu.getAllMenus();
    }
}
